package com.and.util;

import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.core.content.PermissionChecker;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;


import com.and.util.activity.Matrix2DActivity;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;

public class MainActivity extends Activity implements ExampleAdapter.OnItemClickListener {

    private RecyclerView recyclerView;


    private List<String> stringList = Arrays.asList("测试坐标变换功能");

    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        recyclerView = findViewById(R.id.recyclerview);

        ExampleAdapter exampleAdapter = new ExampleAdapter(this, stringList);
        exampleAdapter.setOnItemClickListener(this);
        recyclerView.setAdapter(exampleAdapter);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));


    }

    @Override
    public void onItemClick(int index, String name) {
        if (index == 0) {
            startActivity(new Intent(this, Matrix2DActivity.class));
        }
    }


    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    }
}